<div class="row">
 <small>
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>

  <div class="span8">
     <div class="clearfix txtleft search span8" style="background-color:#f8f8f8; padding:10px; margin:10px 0px;"> 
      <form action="/<*$controller*>/index" method="get"   name="form1" class="form-horizontal">       
          <input type="text" class="span4 input-xlarge" placeholder="请输入机构姓名关键字"  name="groupname" id="groupname" value="<*$groupname*>" >
         <input type="submit" class="btn btn-success"  value="查询"  >
         <div style="float:right; margin-right:20px;"><input type="button" class="btn btn-success" value="增加" onclick="window.location='/<*$controller*>/addgroup'" ></div>
      </form>
	</div>	    

<table class="table">
<tr>
<th>序号</th>
<th>机构名称</th>
<th>旗下学校</th>
<th>合作中</th>
<th>已过期</th>
<!--<th>最后登录时间</th>
<th>登录次数</th>
<th>日志审核</th>
<th>&nbsp;</th>-->
<th>&nbsp;</th>
</tr>
   <*foreach from=$result item=item key=key name=foo*>
   <*eval var=$item.groupid assign="groupid"*>
   <tr>
   <td><*$smarty.foreach.foo.iteration*></td>
   <td><*$item.groupname*></td>
   <td><*$school.$groupid*></td>
<!--   <td><*$item.lasttime*></td>
   <td><*$item.signinnum*></td>
   <td> <*if $item.is_article_self*><button type="button" id="btnname" class="btn  btn-small" value='0'  onclick="opfeed(<*$item.groupid*>,'0')"><i class="icon-remove"></i> 不审核 </button><*else*><button type="button" id="btnname" class="btn  btn-small btn-primary" value='1'  onclick="opfeed(<*$item.groupid*>,'1')"><i class="icon-ok icon-white"></i> 代审核 </button>
       <*/if*>
   </td>
    <td><!--<button type="button" class="btn  btn-small"><i class="icon-wrench"></i> 设置权限</button>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn  btn-small" onclick="javascript:editit(<*$item.groupid*>)"><i class="icon-remove"></i> 修改</button>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn  btn-small" onclick="javascript:deleteit(<*$item.groupid*>)"><i class="icon-remove"></i> 删除</button>&nbsp;&nbsp;&nbsp;&nbsp;--><!--<button type="button" class="btn  btn-small"><i class="icon-lock"></i> 锁定</button></td>-->  
    <td><*$service.$groupid*></td>
    <td><*if $service.$groupid*><*$school.$groupid-$service.$groupid*><*/if*></td>
    <td>&nbsp;</td>
   </tr>
  <*/foreach*>
</table>
<!--
<div  class="control-group form-actions">
<a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-user icon-white"></i> 新增集团用户</a>
</div>
-->
</div>
</div> 
<!-- Modal  
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <form class="form-signin" id="login_form" action="/<*$controller*>/opadd" method="post" onsubmit="return checkLoginForm();">

  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">新增集团用户</h3>
  </div>
  <div class="row">
  <div class="modal-body span3">
        <label class="control-label pull-left" >用户名</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入用户名"  id="groupname" name="groupname" >
        <label class="control-label pull-left" >英文用户名</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入英文用户名"  id="groupname_en" name="groupname_en" >
         <label class="control-label" >密码</label><input type="password" class="input-block-level" placeholder="输入密码" id="password" name="password" >
        <label class="control-label" >再次输入密码</label> <input type="password" class="input-block-level" placeholder="再次输入密码" id="repassword" name="repassword" >
        <label class="control-label pull-left" >邮箱</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入邮箱名"  id="email" name="email" >
        <label class="control-label pull-left" >联系方式</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入联系方式"  id="mobile" name="mobile"  
    
  </div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-primary" type="submit">保存</button>
  </div>
        </form>-->
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript" >
function opfeed(id,str)
{  
	//var str = document.getElementById("btnname").value;  
  	var url     = '/<*$controller*>/op'; 
	var pars = 'id=' + id+'&str='+str;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});
 
     
}


function showResponse_course(originalRequest)
{
	 
	 // alert(originalRequest.responseText);
   
	if(originalRequest.responseText =='-1'){
		 alert('操作失败');
	// document.getElementById('notice').innerHTML = '操作失败！';
		return false;
	}else if(originalRequest.responseText =='1'){
		alert('操作成功');
		 location.href='/<*$controller*>/<*$action*>/'; 
	// document.getElementById('notice').innerHTML = '操作成功';
		return false;
	}else if(originalRequest.responseText =='-3'){
	document.getElementById('notice').innerHTML = '内容不能为空！';
		return false;
	}else if(originalRequest.responseText =='-4'){
		document.getElementById('notice').innerHTML = ''; 
		return false;
	}else if(originalRequest.responseText =='-5'){
	document.getElementById('notice').innerHTML = '操作失败！';
		return false;
	}else if(originalRequest.responseText =='-6'){
	document.getElementById('notice').innerHTML = '内容不能为空！';
		return false;
	}else if(originalRequest.responseText =='-7'){
	document.getElementById('notice').innerHTML = '请选择为题类型！';
		return false;
	} 
  
 
  // document.getElementById('processlist').innerHTML = originalRequest.responseText;

}



function checkLoginForm(){
	var groupname=document.getElementById('groupname').value;
	var groupname_en=document.getElementById('groupname_en').value;
	var password=document.getElementById('password').value;
	var repassword=document.getElementById('repassword').value;
	var email=document.getElementById('email').value;
	var mobile=document.getElementById('mobile').value;
	if(''== groupname){
		alert('需要输入用户名');
		document.getElementById("groupname").focus();
		return false;
	}
	if(''== groupname_en){
		alert('需要输入英文用户名');
		document.getElementById("groupname_en").focus();
		return false;
	}
	if(''== password){
		alert('需要输入密码');
		document.getElementById("password").focus();
		return false;
	}
	if(repassword != password){
		alert('两次密码不一致');
		document.getElementById("repassword").focus();
		return false;
	}
	
	if(''== email){
		alert('需要输入邮箱');
		document.getElementById("email").focus();
		return false;
	}else{
		apos=email.indexOf("@")
		dotpos=email.lastIndexOf(".")
		if (apos<1||dotpos-apos<2){
			alert('请输入正确的邮箱名');
			return false;
		}
	}
	
	if(''== mobile){
		alert('需要输入联系方式');
		document.getElementById("mobile").focus();
		return false;
	}else if(isNaN(mobile)){
		alert("Not Numeric");
		return false;
	}
	return false;
}

function deleteit(id)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/id/'+id;
  }
}

function editit(id)
{
	window.location='/<*$controller*>/edit/id/'+id;
}

  
 
</script>

</div>